﻿using Quartz;

namespace Net7Docker.Jobs
{
    /// <summary>
    /// DisallowConcurrentExecution防止相同Job并发执行，避免资源占用，其他job可以执行
    /// </summary>
    [DisallowConcurrentExecution]
    public class MyJob : IJob
    {
        private readonly ILogger<MyJob> _logger;

        public MyJob(ILogger<MyJob> logger)
        {
            _logger = logger;
        }

        public Task Execute(IJobExecutionContext context)
        {
            _logger.LogInformation("Hello, Quartz!");
            return Task.CompletedTask;
        }
    }
}
